package com.example.ylsys.plants.model;

import android.content.Context;

import com.example.ylsys.plants.bean.BackResultBean;
import com.example.ylsys.plants.bean.LoginParamsBean;
import com.example.ylsys.plants.contract.WelcomingContract;
import com.example.ylsys.plants.database.DbOperation.MyDbOperationUtils;
import com.example.ylsys.plants.net.RetrofitClient;
import com.example.ylsys.plants.net.Url;

import java.util.Map;

import io.reactivex.Observable;

public class WelcomingModel implements WelcomingContract.Role_Model{

    @Override
    public Observable<BackResultBean> post_Api(Map<String, String> url_map, Map<String, String> post_map) {
        return RetrofitClient.getInstance().getApi(Url.LOGIN_SERVICE_URL).get_role(url_map,post_map);
    }

    @Override
    public Observable<BackResultBean> role_get_Api(Map<String, String> url_map) {
        return RetrofitClient.getInstance().getApi(Url.LOGIN_SERVICE_URL).get_data(url_map);
    }

    @Override
    public Observable<BackResultBean> get_Api(Map<String, String> url_map) {
        return RetrofitClient.getInstance().getApi(Url.PALNT_SERVICE_URL).get_data(url_map);
    }

    @Override
    public LoginParamsBean get_userParams(Context context) {
        MyDbOperationUtils myDb=new MyDbOperationUtils();

        return myDb.getLoginParams(context);
    }
}
